# 0
# 显而易见,多态

# 1
# 果断继承一发

# 2
# self将属性保存在内存中

# 3


# 4

# 很显然 __init__()

# 5
# 属性前加双下划线,防止外部访问

class Ticket:
    def __init__(self, weekend: bool = False, child: bool = False):
        super().__init__()
        self.exp = 100

        if weekend:
            inc = 1.2
        else:
            inc = 1

        if child:
            self.childInc = 0.5
        else:
            self.childInc = 1

    def countPrice(self, num):
        return self.exp * self.childInc * num


adult = Ticket()
child = Ticket(child=True)
print('2个成人 + 1个平日票价是:%.2f' % (adult.countPrice(2) + child.countPrice(1)))
